//实现 Runnable 接口
class MyRunnable implements Runnable{
    private int sum = 0;

    public  MyRunnable (int sum){
        this.sum = sum;
    }
    @Override
    public void run() {
        while(true){
            System.out.println("hello Thread"+sum);
        }
    }
}

public class Text2 {
    public static void main(String[] args) {
        //创建 Thread 类实例, 调用 Thread 的构造方法时将 Runnable 对象作为 target 参数
        Thread t1 = new Thread(new MyRunnable(1));
        Thread t2 = new Thread(new MyRunnable(2));

        //调用t线程
        t1.start();
        t2.start();
    }
}
